package com.nine.pattern.prototype;

/**
 * @author nine
 * @version 1.0
 * @description TODO
 * @date 2024-07-03 22:08
 */
public class TestClient {
	public static void main(String[] args) throws CloneNotSupportedException {

		// test1();

		test2();
	}

	private static void test2() throws CloneNotSupportedException {
		Citation c1 = new Citation();
		c1.setName("张三");

		// 浅克隆
		Citation c2 = c1.clone();
		c2.setName("李四");

		c1.show();
		c2.show();
	}

	private static void test1() throws CloneNotSupportedException {
		// 创建对象
		Realizetype r1 = new Realizetype();
		Realizetype r2 = r1.clone();
		// false：克隆创建的是新对象，指向的地址不一样
		System.out.println(r1 == r2);
	}
}
